﻿@using ZBJF.Warranty.Common.Enums
@using ZBJF.Warranty.WebProvider
@model List<ZBJF.Warranty.Model.InsuranceWarrantyRecordStatus>
<div class="page-header">
    <h4>
        状态字段管理
        <small>
            <i class="icon-double-angle-right"></i>
            <span id="ShowText">状态字段编辑</span>
        </small>
    </h4>
</div>

@using (Html.BeginForm("SaveInsuranceWarrantyRecordStatus", "InsuranceWarrantyDealWith", FormMethod.Post, new { id = "UpdateStatusForm", name = "UpdateStatusForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    <fieldset>
        @Html.Hidden("ID")
        <div class="control-group">
            <label class="control-label">状态名称：</label>
            <div class="controls">
                @Html.TextBox("StatusName", "", new { @class = "col-sm-8", validate = "{required:true,messages:{required:'请输入状态名称'}}" , maxLength="20" })
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">状态码：</label>
            <div class="controls">
                @Html.TextBox("StatusCode", "", new { @class = "col-sm-8", validate = "{required:true,messages:{required:'请输入状态码'},range:[1,999]}", maxLength = "3" })
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">父级状态：</label>
            <div class="controls" id="PidSelect">
                <select id="ParentId" name="ParentId" validate = "{required:true,messages:{required:'请选择父级状态'}}" >
                    <option value="">请选择</option>
                    @foreach (var item in PageData["ItemList"])
                    {
                        <option value="@item.ID" StatusCode="@item.StatusCode">@item.StatusName</option>
                    }
                </select>
                <input type="hidden" name="ParentCode" id="ParentCode" value="" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">是否启用：</label>
            <div class="controls">
                <label>
                    <input name="IsAvailable" type="radio" class="ace" value="true" checked="checked" />
                    <span class="lbl">是</span>
                </label>
                <label>
                    <input name="IsAvailable" type="radio" class="ace" value="false" />
                    <span class="lbl">否</span>
                </label>
            </div>
        </div>
    </fieldset>
    <div class="control-group">
        <div class="align-center">
            <button class="btn btn-primary Edit-R" type="submit">
                <i class="icon-ok bigger-110"></i>
                保存
            </button>
            <button class="btn" type="reset" data-dismiss="modal">
                <i class="icon-undo bigger-110"></i>
                取消
            </button>
        </div>
    </div>
}
<script type="text/javascript">
    $(function () {
        $("#ParentId").on("change", function () {
            $("#ParentCode").val($(this).find("option:selected").attr("StatusCode"))
        })
    })
</script>
